home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 1998 November / IRIX 6.5.2 Base Documentation November 1998.img / usr / share / catman / u_man / cat1 / unifdef.z / unifdef
Text File  |  1998-10-20  |  6KB  |  199 lines

  1.  
  2.  
  3.  
  4. UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))                                                          UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      unifdef - strip or reduce ifdefs in C code
  10.  
  11. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.      uuuunnnniiiiffffddddeeeeffff [----DDDD_n_a_m_e]]]] [----DDDD_n_a_m_e=_s_t_r_i_n_g]]]] [----UUUU_n_a_m_e]]]] [----oooo_o_u_t_p_u_t]]]] [----zzzz] [_i_n_p_u_t...]
  13.  
  14. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  15.      _U_n_i_f_d_e_f reads C source files and prints all input lines except those
  16.      excluded by ####iiiiffffddddeeeeffff constructs that refer to specified identifiers.
  17.  
  18.      The ----DDDD option defines _n_a_m_e as a macro with the value 1, causing _u_n_i_f_d_e_f
  19.      to simplify
  20.  
  21.           #ifdef _n_a_m_e
  22.           _I_n_c_l_u_d_e_d _t_e_x_t
  23.           #else
  24.           _E_x_c_l_u_d_e_d _t_e_x_t
  25.           #endif
  26.  
  27.  
  28.      to just
  29.  
  30.           _I_n_c_l_u_d_e_d _t_e_x_t
  31.  
  32.  
  33.      and contrariwise for ####iiiiffffnnnnddddeeeeffff.
  34.  
  35.      The ----UUUU option works like ----DDDD except that _n_a_m_e is undefined, so the ####iiiiffffddddeeeeffff
  36.      above would simplify to
  37.  
  38.           _E_x_c_l_u_d_e_d _t_e_x_t
  39.  
  40.  
  41.      ----DDDD_n_a_m_e=_s_t_r_i_n_g causes _u_n_i_f_d_e_f to replace occurrences of _n_a_m_e with _s_t_r_i_n_g
  42.      when evaluating ####iiiiffff and ####eeeelllliiiiffff expressions.  For example, uuuunnnniiiiffffddddeeeeffff ----DDDDBBBBSSSSDDDD====44443333
  43.      would rewrite
  44.  
  45.           #if BSD == 43
  46.           _4._3_B_S_D _c_o_d_e
  47.           #elif BSD == 42
  48.           _4._2_B_S_D _c_o_d_e
  49.           #endif
  50.  
  51.  
  52.      as
  53.  
  54.           _4._3_B_S_D _c_o_d_e
  55.  
  56.  
  57.      All ####iiiiffffddddeeeeffff constructs that refer to names not defined with ----DDDD or
  58.      undefined with ----UUUU are passed unchanged to output.  _U_n_i_f_d_e_f simplifies ####iiiiffff
  59.      expressions that mix defined or undefined names with unknown names to
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))                                                          UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
  71.  
  72.  
  73.  
  74.      express operations on just the unknown names.  Thus uuuunnnniiiiffffddddeeeeffff ----DDDDssssggggiiii would
  75.      rewrite
  76.  
  77.           #if defined sgi && !defined KERNEL
  78.  
  79.  
  80.      as
  81.  
  82.           #ifndef KERNEL
  83.  
  84.  
  85.      and would preserve associated ####eeeellllsssseeee and ####eeeennnnddddiiiiffff sections.  _U_n_i_f_d_e_f
  86.      simplifies ####eeeelllliiiiffff chains as if they consisted of ####iiiiffff constructs nested
  87.      within ####eeeellllsssseeee sections.  For example, uuuunnnniiiiffffddddeeeeffff ----DDDDBBBBSSSSDDDD====44443333 would rewrite
  88.  
  89.           #if SYSV
  90.           _S_y_s_t_e_m _V _c_o_d_e
  91.           #elif BSD == 42
  92.           _4._2_B_S_D _c_o_d_e
  93.           #elif BSD == 43
  94.           _4._3_B_S_D _c_o_d_e
  95.           #elif XENIX
  96.           _X_e_n_i_x _c_o_d_e
  97.           #endif
  98.  
  99.  
  100.      as
  101.  
  102.           #if SYSV
  103.           _S_y_s_t_e_m _V _c_o_d_e
  104.           #else
  105.           _4._3_B_S_D _c_o_d_e
  106.           #if XENIX
  107.           _X_e_n_i_x _c_o_d_e
  108.           #endif
  109.           #endif
  110.  
  111.  
  112.      _U_n_i_f_d_e_f rewrites ####eeeellllsssseeee and ####eeeennnnddddiiiiffff lines to conform to ANSI C, by
  113.      enclosing any tokens after these keywords with comment delimiters.  For
  114.      example,
  115.  
  116.           #ifdef DEBUG
  117.           _D_e_b_u_g_g_i_n_g _c_o_d_e
  118.           #endif DEBUG
  119.  
  120.  
  121.      would be transcribed as
  122.  
  123.           #ifdef DEBUG
  124.           _D_e_b_u_g_g_i_n_g _c_o_d_e
  125.           #endif /* DEBUG */
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))                                                          UUUUNNNNIIIIFFFFDDDDEEEEFFFF((((1111))))
  137.  
  138.  
  139.  
  140.      _U_n_i_f_d_e_f writes to standard output by default.  The ----oooo option may be used
  141.      in lieu of shell redirection to specify an output file.  More important,
  142.      the file specified by _o_u_t_p_u_t may be identical to one of the _i_n_p_u_t files,
  143.      or to standard input if there are no arguments.  In this case, _u_n_i_f_d_e_f
  144.      will safely overwrite the input file.
  145.  
  146.      The ----zzzz option causes _u_n_i_f_d_e_f to simplify or eliminate sections controlled
  147.      by ####iiiiffff constructs that test constant integer expressions.  By default,
  148.      constructs such as
  149.  
  150.           #if 0
  151.           _E_x_c_l_u_d_e_d _t_e_x_t
  152.           #endif
  153.  
  154.  
  155.      are left intact.
  156.  
  157. AAAAUUUUTTTTHHHHOOOORRRR
  158.      Brendan Eich, 03/16/89
  159.  
  160. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  161.      cc(1), cpp(1).
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.